using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Portal.GUI.Administrator.Login
{
    public partial class MainModule : Portal.API.Module 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void RadAjaxManager1_ResolveUpdatedControls(object sender, Telerik.WebControls.UpdatedControlsEventArgs e)
        {
            Portal.ChannelUsers objUser = new Portal.ChannelUsers();
            if (objUser.Login(txtUser.Text,txtPass.Text))
            {
                if (m_AutoLogin.Checked)
                {
                    HttpCookie cookie = new HttpCookie("PortalUser");
                    cookie.Values["AC"] = Crypto.Encrypt(txtUser.Text);
                    cookie.Values["PW"] = Crypto.Encrypt(txtPass.Text);
                    DateTime dt = DateTime.Now;
                    TimeSpan ts = new TimeSpan(100, 0, 0, 0);
                    cookie.Expires = dt.Add(ts);
                    Response.Cookies.Add(cookie);
                }
                Response.Redirect("Default.aspx");
            }
            else
            {
                //lError.Text = Portal.API.Language.GetText(this, "InvalidLogin");
                PortalDefinition.Tab _objCurrentTab = PortalDefinition.GetCurrentTab();
                Portal.API.Config.RedirectToCurrentTab(_objCurrentTab.reference);
            }
        }
    }
}